// import { Component } from 'react'
import { View, Text, Swiper, SwiperItem, Image } from '@tarojs/components'
import { useReducer } from 'react'
import { homeList } from '@/api/index'
import './index.scss'

import img1 from '../../assets/index-swiper/pexels1.jpg'
import img2 from '../../assets/index-swiper/pexels3.jpg'

export default function Index() {
    const [list, dispatch] = useReducer(async (state, action) => {
        console.log("data.data")
        console.log(data)
        if (action === 1) {
            const data = await homeList()
            console.log("data.data")
            console.log(data)
        }
        return [...state, ...arr]
    }, []);
    console.log(dispatch)
    return (
        <View className='index'>
            <Swiper
                indicatorColor='#999'
                indicatorActiveColor='#333'
                circular
                autoplay
                className='h300'
            >
                <SwiperItem>
                    <Image className='swiper-img' src={img1} />
                </SwiperItem>
                <SwiperItem>
                    <Image className='swiper-img' src={img2} />
                </SwiperItem>
            </Swiper>
            <View>
                {list.map(item => (
                    <View>
                        {item.title}
                    </View>
                ))}
            </View>
        </View>
    )

}
